﻿@using MrCMS.Helpers
@{
    Layout = "~/Areas/Admin/Views/Shared/_LayoutPopup.cshtml";}
@model MrCMS.Entities.Documents.DocumentVersion
<fieldset>
    <legend>@Resource("Admin Webpage Version", "Version") @Model.Id 
        <span class="btn-group  display-inline  pull-right">
            @using (Html.BeginForm("RevertToVersion", "Webpage", new { id = Model.Id }, FormMethod.Post, new { style = "display:inline;" }))
            {
                <input type="submit" class="btn btn-primary" value="@Resource("Admin Webpage Version Revert to version", "Revert to version")" />
            }
        </span>
    </legend>
    @Resource("Admin Webpage Version Edited By","Editied by") @Html.ActionLink(Model.User.Email, "Edit", "User", new { id = Model.User.Id }, null) on @Model.CreatedOn
    <table class="table table-bordered" id="changes-table">
        <thead>
            <tr>
                <th>@Resource("Property")
                </th>
                <th>@Resource("Previous")
                </th>
                <th>@Resource("Current")
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var change in Model.GetComparisonToCurrent())
            {
                <tr class="@(change.AnyChange ? "changed" : "unchanged")">
                    <td>
                        @change.Property
                    </td>
                    <td>
                        @Html.RenderValue(change.PreviousValue)
                    </td>
                    <td>
                        @Html.RenderValue(change.CurrentValue)
                    </td>
                </tr>
            }
        </tbody>
    </table>
</fieldset>
